<?php
/**
 * Quick function
 * these are only for application developer
 *   can't be use in framework
 *
 */

! defined ( 'DIR_SEP' ) && define ( 'DIR_SEP', DIRECTORY_SEPARATOR );
/**
 * long function name url
 * Fetch url for mid
 *
 */
function u() {

}

/**
 * long function name: Mid
 * Mid core function
 *
 */
function m() {

}

/**
 * Long function name import
 * Import file from normal path
 *
 */
function i($str) {
	static $imported_files = array ();
	if (! empty ( $imported_files [$str] ) && $imported_files [$str] === 1) {
		return TRUE;
	}
	$path = $str;
	if (strpos ( $path, '$' ) !== false) {
		$path = str_replace ( '$:', '', $path );
		$path = MID_ROOT . str_replace ( ':', DIR_SEP, $path );
	} else {
		$path = APP_ROOT . str_replace ( ':', DIR_SEP, $path );
	}
	$path = $path . '.php';
	if (! file_exists ( $path )) {
		exit ( "Import Error: $path is not exist!" );
	}
	$imported_files [$str] = 1;
	return (include_once $path);
}

/**
 * Mid load function
 *
 * @param string $path
 * @return OK||''
 */
function l($path) {
	return Mid::load ( $path );
}

/**
 * Print string or array;
 *
 * @param mixed $mixed
 */
function p($mixed) {
	if (is_array ( $mixed )) {
		print_r ( $mixed );
	} else {
		echo $mixed;
	}
}

/**
 * Long Function Name : dirFix
 *
 * @param unknown_type $str
 * @return unknown
 */
function d($str) {
	if ($str && strpos ( $str, '/' ) !== false) {
		return str_replace ( '/', DIR_SEP, $str );
	}
	return $str;
}

/**
 * long function name: config
 * get config
 *
 */
function c($name) {
	if (class_exists ( 'Config' )) {
		return Config::Get ( $name );
	}
	return false;
}
?>